Core.Scheduler.Async = function(interval) {
	this.delayTime = 0;
	this.running = true;
	this.interval = interval;
};

Core.Scheduler.Async.prototype = {
	
	/**
	 * Executes the async object.
	 */
	execute: function() {},
	
	/**
	 * Returns the delay[ms] of the async object execution.
	 */
	getDelay: function() {
		var time = this.delayTime || this.interval;
		
		if(this.delayTime) { this.delayTime = 0; }
		return time;
	},
	
	/**
	 * Starts the async object.
	 * Sets to running & schedules for next execution.
	 */
	start: function() {
		this.running = true;
		return this._reschedule();
	},
	
	/**
	 * Stops async object from scheduling for next execution.
	 * Async object may be executed once more before it's stopped pernamently.
	 */
	stop: function() {
		this.running = false;
	},
	
	/**
	 * Delays the async object execution.
	 * Will delay once on next object's scheduling for execution.
	 */
	delay: function(time) {
		this.delayTime = time;
	},
	
	/**
	 * Schedules async object for next execution if it's still running.
	 */
	_reschedule: function() {
		return Core.Scheduler.schedule(this);
	}
	
	
};